package com.example.demo.demo;

import java.util.function.Function;

/**
 * @author <a href="mailto:zhouyong@cqyyt.com">user</a>
 * @version 1.0
 * @date 2020/7/7 21:44
 */
public class demo2 {

    public static void zy(Function<String,String> function,String msg){
        String r = function.apply(msg);
        System.out.println(r);
    }

    public static void main(String[] args) {
        demo2.zy((String s)->s+"转换", "你好");

        demo2.zy(new Function<String, String>() {
            @Override
            public String apply(String s) {
                return s+"转换";
            }
        }, "你好");

        demo2.zy(new zy(),"你好");
    }

    static class zy implements Function<String,String>{

        @Override
        public String apply(String s) {
            return s+"转换";
        }
    }
}
